<%@tag pageEncoding="UTF-8"%>
<%@ attribute name="page"
	type="com.kaoshi.myweb.common.lib.pagehelper.PageInfo" required="true"%>
<%@ attribute name="paginationSize" type="java.lang.Integer"
	required="true"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
int current =  page.getPageNum();
int begin = page.getFirstPage();
int end = page.getLastPage();

request.setAttribute("current", current);
request.setAttribute("begin", begin);
request.setAttribute("end", end);
%>

<div class="pagination">
	<ul>
		<% if (current > begin){%>
		<li><a href="?page=${begin}&sortType=${sortType}&${searchParams}">&lt;&lt;</a></li>
		<li><a
			href="?page=${current-1}&sortType=${sortType}&${searchParams}">&lt;</a></li>
		<%}else{%>
		<li class="disabled"><a href="#">&lt;&lt;</a></li>
		<li class="disabled"><a href="#">&lt;</a></li>
		<%} %>

		<c:forEach var="i" begin="${begin}" end="${end}">
			<c:choose>
				<c:when test="${i == current}">
					<li class="active"><a
						href="?page=${i}&sortType=${sortType}&${searchParams}">${i}</a></li>
				</c:when>
				<c:otherwise>
					<li><a href="?page=${i}&sortType=${sortType}&${searchParams}">${i}</a></li>
				</c:otherwise>
			</c:choose>
		</c:forEach>

		<% if (current < end){%>
		<li><a
			href="?page=${current+1}&sortType=${sortType}&${searchParams}">&gt;</a></li>
		<li><a href="?page=${end}&sortType=${sortType}&${searchParams}">&gt;&gt;</a></li>
		<%}else{%>
		<li class="disabled"><a href="#">&gt;</a></li>
		<li class="disabled"><a href="#">&gt;&gt;</a></li>
		<%} %>

	</ul>
</div>

